package com.vvv.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author vvv
 * @date 2023-06-11 14 54
 * discription
 */
@RestController
@RequestMapping("/test")
public class HelloController {

    /**
     *
     * @return
     */
    @PreAuthorize("hasAnyAuthority('test')")
    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    /**
     * 自定义权限校验方法
     * @return
     */
    @PreAuthorize("@ex.hasAuthority('list')")
    @GetMapping
    public String test() {
        return "自定义权限校验方法成功";
    }
}
